package com.mku.wms_service.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mku.wms_service.common.QueryPageParam;
import com.mku.wms_service.common.Response;
import com.mku.wms_service.entity.Goodstype;
import com.mku.wms_service.service.IGoodstypeService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author maoxx
 * @since 2024-11-22
 */
@RestController
@RequestMapping("/goodstype")
public class GoodstypeController {

    @Autowired
    private IGoodstypeService goodstypeService;

    @ApiOperation("分页查询商品类型")
    @PostMapping("/listPage")
    public Response<Page<Goodstype>> listPage(@RequestBody QueryPageParam qp2) {
        return goodstypeService.listPage(qp2);
    }

    @ApiOperation("添加/编辑商品类型")
    @PostMapping
    public Response<Boolean> add(@RequestBody Goodstype goodstype) {
        return goodstypeService.add(goodstype);
    }

    @ApiOperation("删除商品类型")
    @DeleteMapping("/{id}")
    public Response<Boolean> delete(@PathVariable Integer id) {
        return goodstypeService.delete(id);
    }

    @ApiOperation("获取商品类型详情列表")
    @GetMapping("/listAll")
    public Response<List<Goodstype>> listAll() {
        return goodstypeService.listAll();
    }


}
